﻿using CleanArchitecture.Infrastructure.Entities.System.Notice;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CleanArchitecture.Infrastructure.DataMapping.Notice
{
    /// <summary>
    /// Represents a SystemNotice configuration
    /// </summary>
    public partial class SystemNoticeMap : NowaEntityTypeConfiguration<SystemNotice>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<SystemNotice> builder)
        {
            builder.ToTable("sys_notice");
            builder.HasKey(notice => notice.Id);

            builder.Property(notice => notice.NoticeText).HasMaxLength(2000).IsRequired();
            builder.Property(notice => notice.NoticeTitle).HasMaxLength(200).IsRequired();
            builder.Property(notice => notice.Publisher).HasMaxLength(50).IsRequired();
            base.Configure(builder);
        }

        #endregion
    }
}
